package cn.edu.scnu.service;

import cn.edu.scnu.common.MD5Util;
import cn.edu.scnu.entity.TbMember;
import cn.edu.scnu.mapper.MemberMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.awt.*;
@Service
public class MemberService extends ServiceImpl<MemberMapper, TbMember> {
    private MemberMapper memberMapper;
    private RedisTemplate redisTemplate;
    public MemberService(MemberMapper memberMapper,RedisTemplate redisTemplate){
        this.memberMapper = memberMapper;
        this.redisTemplate = redisTemplate;
    }

    public TbMember login(String email, String password) {
        TbMember member = memberMapper.selectById(email);
        if(member!=null&&member.getPassword().equals(MD5Util.md5(password)))
            return member;
        else return null;
    }
}
